<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <script th:src="@{/jquery-1.11.3.min.js}"></script>
    <link th:href="@{/bootstrap-4.5.0-dist/css/bootstrap.css}" rel="stylesheet">

    <title>Title</title>
</head>
<body th:onload="myfun()">

<div class="container">
    <h3 class="text-center" style="text-align: center"><img th:src="@{/image/2.png}" ></h3>
    <div style="margin-top:20px " >
        <input type="text" class="am-form-field" style="margin-bottom: 20px;width: 250px;height: 40px" placeholder="请输入姓名查询" id="houseadress">
        <span class="am-input-group-btn">
                            <button class="btn btn-success" onclick="showHouse()"><span>搜索</span></button>
                </span>
        <a class="btn btn-success" th:href="@{/jpauser/addUser}">添加</a>
        <a class="btn btn-success" th:href="@{/ac/checkall}">考勤查询</a>
        <a class="btn btn-success" th:href="@{/ac/goinfo}">消息处理</a>

    </div>
    <table class="table">
        <tr>
            <th>编号</th>
            <th>账号</th>
            <th>密码</th>
            <th>姓名</th>
            <th>性别</th>
            <th>电话</th>
            <th>业绩</th>
            <th>工资</th>
            <th>操作</th>
        </tr>
        <tr th:each="one:${page}">
            <td th:text="${one.id}"></td>
            <td th:text="${one.account}"></td>
            <td th:text="${one.password}"></td>
            <td th:text="${one.name}"></td>
            <td th:text="${one.sex}"></td>
            <td th:text="${one.phone}"></td>
            <td><a class="btn btn-success" href="javascript:void(0)" th:href="@{/ac/allac/} + (${one.id})">查询销售员业绩</a></td>
            <td><a class="btn btn-success" href="javascript:void(0)" th:href="@{/ac/gz/} + (${one.id})">结算本月工资</a></td>
            <td><a class="btn btn-success" th:href="@{/jpauser/updateUser/} + ${one.id}">编辑</a>
                <a class="btn btn-success" href="javascript:void(0)" th:onclick="|del(${one.id})|">删除</a></td>
        </tr>


        <tr>
            <td colspan="8">

        <div class="modal-footer no-margin-top">

            <ul class="pagination pull-right no-margin">

                <p>当前<span th:text="${page.getNumber()} + 1"></span>页,总<span th:text="${page.totalPages}"></span>页
                    共<span th:text="${page.totalElements}"></span>条记录

                    <a th:href="@{/jpauser/pageUser}">首页</a>
                <li th:if="${page.hasPrevious()}">
                    <a th:href="@{/jpauser/pageUser(pageNum = ${page.hasPrevious()} ? ${page.getNumber() } : 1)}">上一页</a>
                </li>



                <li th:if="${page.hasNext()}">
                    <a th:href="@{/jpauser/pageUser(pageNum = ${page.hasNext()} ? ${page.getNumber()} + 2 : ${page.totalPages})}">下一页</a>
                </li>
                <li>
                    <a th:href="@{/jpauser/pageUser(pageNum = ${page.totalPages})}">尾页</a></p>
                </li>


            </ul>


        </div>

        </td>
        </tr>



    </table>


</div>




<script th:inline="javascript">



    function del(id) {
        if (confirm("你真的要删除吗")){
            $.ajax({
                url:[[@{/jpauser/deleteUser/}]]+id,
                method:"POST",
                data:{
                _method:"delete"
            },
            success:function(data) {
                if (data=="success"){
                    alert("删除成功")
                    location.reload();
                }else {
                    alert("删除失败")
                }
            }
        });
        }
    }


</script>
<script th:inline="javascript">
    function myfun() {
        var num = [[${num}]]
        console.log(num);
        if (num > 0) {
            alert("你有" + num + "条消息未处理")
        }
    }
</script>
</body>
</html>
